package com.cwh.springbootMybatis.controller;

import com.alibaba.fastjson.JSONObject;
import com.cwh.springbootMybatis.mapper.OamanageMapper;
import com.cwh.springbootMybatis.service.OAService;
import com.fasterxml.jackson.databind.util.JSONPObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

/**
 * @ClassName OAController
 * @Description TODO
 * @Author zhengchenggong
 * @Date 2020/4/29 2:07 下午
 * @Version 1.0
 **/

@Controller
@RequestMapping("/apis/v1/rest/oaTokensx")
public class OAController {
    @Autowired
    OamanageMapper oamanageMapper;

    @Autowired
    OAService oaService;

    @RequestMapping("/OuterAccess_getAccessToken.do")
    @ResponseBody
    public JSONObject getAccessToken(HttpServletRequest request){

        return oaService.getAccessToken(request);

    }

    @RequestMapping("/OuterAccess_doBiz.do")
    @ResponseBody
    public JSONObject doBiz(HttpServletRequest request){

        return oaService.doBiz(request);
    }

//    127.0.0.1:9999/apis/v1/rest/oaTokensx/doAudit?token=1
    @RequestMapping("/doAudit")
    public String doAudit(HttpServletRequest request){
        oaService.doAudit(request);
        return "";
    }


    @RequestMapping("/test")
    @ResponseBody
    public Map test(HttpServletRequest request){
        System.out.println(request.getParameter("aa"));
        Map map = new HashMap();
        map.put("flag","0");
        return map;
    }



}
